-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use matlab_cmd provided as input closes #2442 #2452
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2452 +/- ##
==========================================
+ Coverage 66.62% 66.65% +0.02%
==========================================
Files 328 328
Lines 42508 42513 +5
Branches 5280 5277 -3
==========================================
+ Hits 28321 28337 +16
+ Misses 13505 13496 -9
+ Partials 682 680 -2
Continue to review full report at Codecov.
|
If you use `SPMCommand.set_mlab_paths` to set alternate entries for | ||
matlab_cmd, paths, and use_mcr, then you will need to use the same entries | ||
to any call in the Info class to maintain memoization. Otherwise, it will | ||
default to the parameters in the `getinfo` function below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm conceptually a little displeased with this memoization principle, but in practice I imagine nobody's using multiple MATLABs and SPMs within a single nipype script, so it's probably fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually i think this exactly handles the multiple matlab/spm scenario. let's say i have two different versions of spm. i can explicitly use Info to retrieve them (yes, it will loose the first memory on collecting the second one).
the situation, i think, boils down to this.
SPMCommand.set_mlab_paths
is a class method, so every instance derived will respect it. and i can adjust any given instance to change its command/path.
Info
only has class methods and we would somehow need to detect a change. this method decouples the change detection saying the only memory it has is when you pass the same parameters.
an alternative was the previous augmented version to set the Info
attributes everytime set_mlab_paths
is called, retrieve that information and store it and always return that unless its changed again with get_info call.
i don't feel strongly about either. just think that the latter seems more magical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, in the sense that this will be correct. The issue I was seeing with multiple versions I have is that you're running a MATLAB instance every time the cache is invalidated to get the information.
But it really doesn't matter. If people start complaining about slowdowns, we can consider keeping a memoizing dict keyed on a 3-tuple. This is probably fine, though.
Merged master to bump the tests. |
""" | ||
_path = None | ||
_name = None | ||
_command = None | ||
_paths = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't you also add _version = None
* upstream/master: CI: Rebalance Circle jobs DOCKER: Hard-code Miniconda version CI: Revert to Miniconda 4.3.31 FIX: asn1crypto 0.24 incompatible with Python <= 3.6 drop Upcoming release if present add URL, drop Upcoming release Fix my doctest and add test_auto file Fix doctest and make vars more explicit Fix doctest filenames remove -e which should not be there [ENH] Automate updates of CHANGES Add first remarks from PR Add SPM Fieldmap Tool wrapper Added: - VDM Calculation pre-substracted phase case (SIEMENS machines) Todo: - Support VDM Application - Support different magnitude and phase file types
* origin/fix/spminfo:
or os.getenv('MATLABCMD', 'matlab -nodesktop -nosplash')) | ||
|
||
if klass._name and klass._path and klass._version and \ | ||
klass._command == matlab_cmd and klass._paths == paths: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is related to your discussion with @effigies. Shouldn't we add some warnings if klass._command != matlab_cmd
or klass._paths != paths
. Not sure how likely this might eb due to mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not a big fan of warnings. almost no one reads it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, you're probably right, but personally I sometimes read them if I feel hopeless...
is this ok for merge? |
@effigies - sorry had forgotten to commit and push. |
i've never used Matlab on my OSX and had to figure out the license etc., but now it looks like it can find a version of spm (but
|
@djarecka - your output is correct. to get the same version as returned by i could make the change that in the version before the current change: let me think about this and determine which i like more tomorrow. |
oh yes, I completely forgot! Now everything looks good:
|
@@ -171,7 +171,10 @@ def getinfo(klass, matlab_cmd=None, paths=None, use_mcr=None): | |||
If none of the above was successful, the fallback value of | |||
'matlab -nodesktop -nosplash' will be used. | |||
paths : str | |||
Add paths to matlab session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we suggest that here should be also path to spm
(that can be completely different than matlab) if we want to run spm interfaces ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, that's clear from the function description: "Returns the path to the SPM directory in the Matlab path".
Updated the description to auto-close #2436. Undo if this only partially resolves that issue. |
see discussion in #2442
Closes #2436.